<%@ page import="com.CusterRelSys.entity.BasDict" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: dylx
  Date: 2017/12/1
  Time: 15:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>


<html>
<head>
    <base href="${rootpath }"/>
    <%--<base href="${}"--%>
    <title>毕业设计项目</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="../css/style.css" rel="stylesheet" type="text/css">
    <script src="../script/common.js"></script>


    <style type="text/css">
        .menu-bg,.top-bg,.welcome{
            background-color:#f6f5ec;
        }
    </style>

    <%--<%@ include file="main-js.jsp" %>--%>
    <script type="text/javascript">
        function addTab(title, url){
            if ($('#tabs').tabs('exists', title)){
                $('#tabs').tabs('select', title);//选中并刷新
                var currTab = $('#tabs').tabs('getSelected');
                //currTab.addClass("tabs-inner");
                var url = $(currTab.panel('options').content).attr('src');
                if(url != undefined && currTab.panel('options').title != 'Home') {
                    $('#tabs').tabs('update',{
                        tab:currTab,
                        options:{
                            content:createFrame(url)
                        }
                    });
                }
            } else { //标签页未打开时，添加新的标签页
                var content = createFrame(url);
                $('#tabs').tabs('add',{
                    title:title,
                    content:content,
                    closable:true
                });
            }
            tabClose(); //标签页上右键菜单
        }
        function createFrame(url) {
            var s = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';
            return s;
        }

        function tabClose() {
            /*双击关闭TAB选项卡*/
            $(".tabs-inner").dblclick(function(){
                //通过选项卡的标题找到要关闭tab页
                var subtitle = "<img src='images/msn.gif' style='vertical-align:middle'>"+$(this).children(".tabs-closable").text();
                $('#tabs').tabs('close',subtitle);
            });
            /*为选项卡绑定右键*/
            $(".tabs-inner").bind('contextmenu',function(e){
                $('#mm').menu('show', {
                    left: e.pageX,
                    top: e.pageY
                });
                var subtitle =$(this).children(".tabs-closable").text();
                $('#mm').data("currtab",subtitle);
                $('#tabs').tabs('select',subtitle);
                return false;
            });
        }

        //绑定右键菜单事件
        function tabCloseEven() {
            //刷新
            $('#mm-tabupdate').click(function(){
                var currTab = $('#tabs').tabs('getSelected');
                var url = $(currTab.panel('options').content).attr('src');
                if(url != undefined && currTab.panel('options').title != 'Home') {
                    $('#tabs').tabs('update',{
                        tab:currTab,
                        options:{
                            content:createFrame(url)
                        }
                    });
                }
            });
            //全部关闭
            $('#mm-tabcloseall').click(function(){
                $('.tabs-inner span').each(function(i,n){
                    var t = "<img src='images/msn.gif' style='vertical-align:middle'>"+$(n).text();
                    if(t != 'Home') {
                        $('#tabs').tabs('close',t);
                    }
                });
            });
            //关闭除当前之外的TAB
            $('#mm-tabcloseother').click(function(){
                var prevall = $('.tabs-selected').prevAll();
                var nextall = $('.tabs-selected').nextAll();
                if(prevall.length>0){
                    prevall.each(function(i,n){
                        var t="<img src='images/msn.gif' style='vertical-align:middle'>"+$('a:eq(0) span',$(n)).text();
                        if(t != 'Home') {
                            $('#tabs').tabs('close',t);
                        }
                    });
                }
                if(nextall.length>0) {
                    nextall.each(function(i,n){
                        var t="<img src='images/msn.gif' style='vertical-align:middle'>"+$('a:eq(0) span',$(n)).text();
                        if(t != 'Home') {
                            $('#tabs').tabs('close',t);
                        }
                    });
                }
                return false;
            });
        }

        $(function() {
            tabCloseEven();

            $('.cs-navi-tab').click(function() {
                var $this = $(this);
                var href = $this.attr('src');
                var title = "<img src='images/msn.gif' style='vertical-align:middle'>"+$this.text();
                addTab(title, href);
            });
            //切换菜单项前的图标
            $(".cs-navi-tab").hover(
                function(){
                    $(this).find("img").attr("src","images/ns_doc_mo.gif");
                },
                function(){
                    $(this).find("img").attr("src","images/ns_doc.gif");
                }
            );
        });


        function setCookie(name,value) {//两个参数，一个是cookie的名字，一个是值
            var Days = 30; //此 cookie 将被保存 30 天
            var exp = new Date();    //new Date("December 31, 9998");
            exp.setTime(exp.getTime() + Days*24*60*60*1000);
            document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
        }

        function getCookie(name) {//取cookies函数
            var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
            if(arr != null) return unescape(arr[2]); return null;
        }

        //退出该系统
        function logout(){
            $.messager.confirm('确认对话框', '您想要退出该系统吗？', function(r){
                if (r){ //退出操作;
                    //location.replace("url");
                }
            });
        }
    </script>

</head>

<body class="easyui-layout" >

<div class="page_title">数据字典管理 > 新建数据字典条目</div>
<form action="/test/updateAll"  method="get">
    <div class="button_bar">
        <button class="common_button" onclick="help('');">帮助</button>
        <button class="common_button" onclick="back();">返回</button>
        <button class="common_button" type="submit">保存</button>
    </div>
    <table class="query_form_table">


        <tr>
            <th>编号</th>
            <td><input  name="dict_id" id="dict_id"<%-- value="<%=request.getAttribute("id")%>"--%>value="${basdict.dict_id}" ></td>
            <th>类别</th>
            <td><input name="dicttype" id="dicttype" <%--value="<%=request.getAttribute("type")%>"--%>value="${basdict.dicttype}"><span class="red_star">*</span><br />（需要使用Ajax实现自动补全功能）</td>
        </tr>
        <tr>
            <th>条目</th>
            <td><input name="dictitem" id="dictitem" <%--value="<%=request.getAttribute("item")%>"--%>value="${basdict.dictitem}"><span class="red_star">*</span></td>
            <th>值</th>
            <td><input name="dictvalue" id="dictvalue" <%--value="<%=request.getAttribute("value")%>--%>value=" ${basdict.dictvalue}"><span class="red_star">*</span></td>
        </tr>
        <tr>
            <th>是否可编辑</th>
            <td><input type="checkbox" checked name="checkstate" id="dictiseditable" <%--value="<%=request.getParameter("isb")%>"--%>value="${basdict.dictiseditable}" ></td>
            <th>&nbsp;</th>
            <td>&nbsp;</td>
        </tr>

    </table>
</form>

</body>
<%--<script>
    $('#form').submit(function (e) {
        e.preventDefault();
        var form = $('form')[0];
        var formData = new FormData(form);
        $.ajax({
           /* url: 'test/addAll',*/
            data: formData,
            type: 'post',
            dataType: 'text',
            cache: false,//不使用缓存
            traditional: true,//这个属性默认是false,jquery会深度序列化这个对象，以适应PHP等框架
            contentType: false,//告诉jQuery不要去设置content-type开头
            processData: false,//告诉jQuery不要去处理发送的数据
            success: function (data) {
                alert('插入成功');
            },
            error: function () {
                alert('插入失败');
            }
        });
    });
</script>--%>
</html>
